package com.deer.wms.system.manage.model.role;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author wei
 */
@Getter
@Setter
@NoArgsConstructor
public class Role{
    /**
     * 角色信息id
     */
    @Id
    @Column(name = "role_id")
    @TableId(type = IdType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer roleId;
    /**
     * 角色名称
     */
    @Column(name = "role_name")
    private String roleName;

    /**
     * 父级角色id
     */
    @Column(name = "parent_role_id")
    private Integer parentRoleId;

    /**
     * 角色层级
     */
    @Column(name = "role_level")
    private Integer roleLevel;

    /**
     * 角色描述
     */
    @Column(name = "role_describe")
    private String roleDescribe;

    // 没有映射上状态这个字段，会导致更新后state为空
    /**
     * 信息状态：normal=正常的；invalid=无效的；deleted=已删除；默认正常的
     */
    @Column(name = "state")
    private String state;

    /**
     * 创建人
     */
    protected Integer createUserId;

 //    @TableField(fill = FieldFill.INSERT, update = "NOW()")
//    protected Date createTime;
    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT, update = "NOW()")
    protected LocalDateTime createTime;
    /**
     * 修改人
     */
    protected Integer modifyUserId;

    /**
     * 修改时间
     */
    @TableField(fill = FieldFill.UPDATE)
    protected LocalDateTime modifyTime;

}